import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component: () => import(/* webpackChunkName: "login" */ '@/views/login/index.vue'),
  },
  // admin 路由
  {
    path: '/admin',
    name: 'admin',
    meta: { requireAuth: true },
    component: () => import(/* webpackChunkName: "login" */ '@/views/admin/index.vue'),
    redirect: '/card',
    children: [
      {
        path: '/card',
        name: '日期页面',
        meta: { requireAuth: true },
        component: () => import(/* webpackChunkName: "login" */ '@/components/Card.vue'),
        children: [
          {
            path: '/card',
            name: '日期展示',
            meta: { requireAuth: true },
            component: () => import(/* webpackChunkName: "login" */ '@/components/Card.vue'),
          }
        ]
      },
      {
        path: '/studentManage',
        name: '学生管理',
        meta: { requireAuth: true },
        component: () => import(/* webpackChunkName: "login" */ '@/views/admin/studentManage/index.vue'),
        children: [
          {
            path: '/addStudent',
            name: '添加学生',
            meta: { requireAuth: true },
            component: () => import(/* webpackChunkName: "login" */ '@/views/admin/studentManage/addStudent.vue'),
          },
          {
            path: '/studentList',
            name: '学生列表',
            meta: { requireAuth: true },
            component: () => import(/* webpackChunkName: "login" */ '@/views/admin/studentManage/studentList.vue'),
          },
          {
            path: '/queryStudent',
            name: '查询学生',
            meta: { requireAuth: true },
            component: () => import(/* webpackChunkName: "login" */ '@/views/admin/studentManage/queryStudent.vue'),
            children: [
              {
                path: '/queryStudent/studentList',
                meta: { requireAuth: true },
                component: () => import(/* webpackChunkName: "login" */ '@/views/admin/studentManage/studentList.vue'),
              }
            ]
          },
          {
            path: '/editorStudent',
            name: '编辑学生',
            meta: { requireAuth: true },
            component: () => import(/* webpackChunkName: "login" */ '@/views/admin/studentManage/editorStudent.vue'),
          }
        ]
      },
      {
        path: '/courseManage',
        name: '课程管理',
        meta: { requireAuth: true },
        component: () => import(/* webpackChunkName: "login" */ '@/views/admin/courseManage/index.vue'),
        children: [
          {
            path: '/addCourse',
            name: '添加课程',
            meta: { requireAuth: true },
            component: () => import(/* webpackChunkName: "login" */ '@/views/admin/courseManage/addCourse.vue'),
          },
          {
            path: '/courseList',
            name: '课程列表',
            meta: { requireAuth: true },
            component: () => import(/* webpackChunkName: "login" */ '@/views/admin/courseManage/courseList.vue'),
          },
          {
            path: '/queryCourse',
            name: '查询课程',
            meta: { requireAuth: true },
            component: () => import(/* webpackChunkName: "login" */ '@/views/admin/courseManage/queryCourse.vue'),
            children: [
              {
                path: '/courseList',
                meta: { requireAuth: true },
                component: () => import(/* webpackChunkName: "login" */ '@/views/admin/courseManage/courseList.vue')
              }
            ]
          },
          {
            path: '/editorCourse',
            name: '编辑课程',
            meta: { requireAuth: true },
            component: () => import(/* webpackChunkName: "login" */ '@/views/admin/courseManage/editorCourse.vue'),
          }
        ]
      },
      {
        path: '/teacherManage',
        name: '教师管理',
        component: () => import(/* webpackChunkName: "login" */ '@/views/admin/teacherManage/index.vue'),
        meta: { requireAuth: true },
        children: [
          {
            path: '/teacherList',
            name: '教师列表',
            component: () => import(/* webpackChunkName: "login" */ '@/views/admin/teacherManage/teacherList.vue'),
            meta: { requireAuth: true }
          },
          {
            path: '/addTeacher',
            name: '添加教师',
            component: () => import(/* webpackChunkName: "login" */ '@/views/admin/teacherManage/addTeacher.vue'),
            meta: { requireAuth: true }
          },
          {
            path: '/queryTeacher',
            name: '查询教师',
            component: () => import(/* webpackChunkName: "login" */ '@/views/admin/teacherManage/queryTeacher.vue'),
            meta: { requireAuth: true },
            children: [
              {
                path: '/teacherList',
                name: '教师列表',
                component: () => import(/* webpackChunkName: "login" */ '@/views/admin/teacherManage/teacherList.vue'),
                meta: { requireAuth: true }
              },
            ]
          },
          {
            path: '/editorTeacher',
            name: '编辑教师',
            component: () => import(/* webpackChunkName: "login" */ '@/views/admin/teacherManage/editorTeacher.vue'),
            meta: { requireAuth: true }
          },
        ]
      },
      {
        path: '/CourseTeacher',
        name: '课表管理',
        component: () => import(/* webpackChunkName: "login" */ '@/views/admin/selectCourseManage/index.vue'),
        meta: { requireAuth: true },
        children: [
          {
            path: '/queryCourseTeacher',
            name: '开课管理',
            component: () => import(/* webpackChunkName: "login" */ '@/views/admin/selectCourseManage/queryCourseTeacher.vue'),
            meta: { requireAuth: true },
          },
          {
            path: '/CourseTeacherList',
            name: '教师课程列表',
            component: () => import(/* webpackChunkName: "login" */ '@/views/admin/selectCourseManage/CourseTeacherList.vue'),
            meta: { requireAuth: true },
          }
        ]
      },
      {
        path: '/gradeCourseManage',
        name: '学生成绩管理',
        component: () => import(/* webpackChunkName: "login" */ '@/views/admin/gradeCourseManage/index.vue'),
        meta: { requireAuth: true },
        children: [
          {
            path: '/gradeCourseList',
            name: '学生成绩列表',
            component: () => import( /* webpackChunkName: "login" */ '@/views/admin/gradeCourseManage/gradeCourseList.vue'),
            meta: { requireAuth: true },
          },
          {
            path: '/queryGradeCourse',
            name: '学生成绩查询',
            component: () => import(/* webpackChunkName: "login" */ '@/views/admin/gradeCourseManage/queryGradeCourse.vue'),
            meta: { requireAuth: true },
          },
          {
            path: '/editorGradeCourse',
            name: '学生成绩编辑',
            component: () => import(/* webpackChunkName: "login" */ '@/views/admin/gradeCourseManage/editorGradeCourse.vue'),
            meta: { requireAuth: true }
          }
        ]
      }
    ],
  },
  // teacher 路由
  {
    path: '/teacher',
    name: 'teacher',
    component: () => import(/* webpackChunkName: "login" */ '@/views/teacher/index.vue'),
    redirect: '/card',
    children: [
      {
        path: '/card',
        name: '查看日期',
        component: () => import(/* webpackChunkName: "login" */ '@/components/Card.vue'),
      },
      {
        path: '/updateInfo',
        name: '教师编辑',
        component: () => import(/* webpackChunkName: "login" */ '@/components/updateInfo.vue'),
        meta: { requireAuth: true },
        children: [
          {
            path: '/updateInfoHome',
            name: '编辑教师信息',
            component: () => import(/* webpackChunkName: "login" */ '@/components/updateInfo.vue'),
            meta: { requireAuth: true }
          }
        ]
      },
      {
        path: '/courseManage',
        name: '课程设置',
        meta: { requireAuth: true },
        component: () => import(/* webpackChunkName: "login" */ '@/views/teacher/setCourse.vue'),
        children: [
          {
            path: '/myOfferCourse',
            name: '我开设的课程',
            component: () => import(/* webpackChunkName: "login" */ '@/views/teacher/myOfferCourse.vue'),
            meta: { requireAuth: true }
          },
          {
            path: '/offerCourse',
            name: '开设课程',
            component: () => import(/* webpackChunkName: "login" */ '@/views/teacher/offerCourse.vue'),
            meta: { requireAuth: true }
          },
        ]
      },
      {
        name: '教师成绩管理',
        path: '/teacherQueryGradeCourseManage',
        component: () => import(/* webpackChunkName: "login" */ '@/views/teacher/teacherGradeCourseManage/index.vue'),
        meta: { requireAuth: true },
        children: [
          {
            path: '/teacherQueryGradeCourseManage',
            name: '成绩管理',
            component: () => import(/* webpackChunkName: "login" */ '@/views/teacher/teacherGradeCourseManage/teacherQueryGradeCourse.vue'),
            meta: { requireAuth: true }
          },
          {
            path: '/teacherEditorGradeCourse',
            name: '编辑成绩',
            component: () => import(/* webpackChunkName: "login" */ '@/views/teacher/teacherGradeCourseManage/teacherEditorGradeCourse.vue'),
            meta: { requireAuth: true }
          },
          {
            path: '/teacherGradeCourseList',
            name: '成绩列表',
            component: () => import(/* webpackChunkName: "login" */ '@/views/teacher/teacherGradeCourseManage/teacherGradeCourseList.vue'),
            meta: { requireAuth: true }
          }
        ]
      }
    ]
  },
  // student 路由
  {
    path: '/student',
    name: 'student',
    meta: { requireAuth: true },
    component: () => import(/* webpackChunkName: "login" */ '@/views/student/index.vue'),
    redirect: '/card',
    children: [
      {
        path: '/card',
        name: '日期页面',
        meta: { requireAuth: true },
        component: () => import(/* webpackChunkName: "login" */ '@/components/Card.vue'),
        children: [
          {
            path: '/card',
            name: '日期页面',
            meta: { requireAuth: true },
            component: () => import(/* webpackChunkName: "login" */ '@/components/Card.vue'),
          }
        ]
      },
      {
        path: '/updateInfo',
        name: '学生编辑',
        component: () => import(/* webpackChunkName: "login" */ '@/components/updateInfo.vue'),
        meta: { requireAuth: true },
        children: [
          {
            path: '/updateInfoHome',
            name: '编辑学生信息',
            component: () => import(/* webpackChunkName: "login" */ '@/components/updateInfo.vue'),
            meta: { requireAuth: true }
          }
        ]
      },
      {
        path: '/studentSelectCourseManage',
        name: '选课管理',
        component: () => import(/* webpackChunkName: "login" */ '@/views/student/selectCourse/index.vue'),
        meta: { requireAuth: true },
        children: [
          {
            path: '/studentSelectCourse',
            name: '选课',
            component: () => import(/* webpackChunkName: "login" */ '@/views/student/selectCourse/selectCourse.vue'),
            meta: { requireAuth: true }
          },
          {
            path: '/querySelectedCourse',
            name: '查询课表',
            component: () => import(/* webpackChunkName: "login" */ '@/views/student/selectCourse/querySelectedCourse.vue'),
            meta: { requireAuth: true }
          },
          {
            path: '/selectCourseList',
            name: '选课列表',
            component: () => import(/* webpackChunkName: "login" */ '@/views/student/selectCourse/selectCourseList.vue'),
            meta: { requireAuth: true }
          }
        ]
      },
      {
        path: '/courseGrade',
        name: '学生成绩管理',
        component: () => import(/* webpackChunkName: "login" */ '@/views/student/courseGrade/index.vue'),
        meta: { requireAuth: true },
        children: [
          {
            path: '/queryCourseGrade',
            name: '成绩查询',
            component: () => import(/* webpackChunkName: "login" */ '@/views/student/courseGrade/queryCourseGrade.vue'),
            meta: { requireAuth: true }
          },
        ]
      }
    ]
  },

]

const router = new VueRouter({
  routes
})

export default router
